home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} UserForm1
- Caption = "Mostra valori foglio corrente"
- ClientHeight = 3225
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 4710
- OleObjectBlob = "UserForm1.frx":0000
- StartUpPosition = 1 'CenterOwner
- Attribute VB_Name = "UserForm1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub CommandButton1_Click()
- Dim str As String
- str = Application.GetOpenFilename()
- If (str <> "Falso" And str <> "False") Then MostraCelle str
- End Sub
- Private Sub TextBox1_AfterUpdate()
- Call MostraCelle(TextBox1.Text)
- End Sub
- Private Sub UserForm_Initialize()
- Call MostraCelle(TextBox1.Text)
- End Sub
- Private Sub MostraCelle(filePath As String)
- Dim sheet As Excel.Worksheet
- Dim rng As Excel.Range
- Dim cella As Variant
- Dim ch As String
- On Error GoTo Errore
- If (filePath > "") Then
- Set sheet = Application.Workbooks.Open(filePath).Worksheets(1)
- sheet.Activate
- End If
- ListBox1.Clear
- Set sheet = Application.ActiveSheet
- Set rng = sheet.Cells.CurrentRegion
- For Each cella In rng
- If (cella.Text > "") Then ListBox1.AddItem cella.Text
- Next
- GoTo Fine
- Errore:
- MsgBox "Si
- verificato un errore aprendo il file:" & vbCrLf & _
- Err.Description
- Fine:
- End Sub
-